//###############
//FILE : NameEndSession.java
//WRITER : Daniel Lowengrub, daniel_i_l, 320687098
//EXERCISE : oop ex3 2011
//DESCRIPTION:
//See below
//###############

package oop.ex3.protocol.sessions;

import oop.ex3.protocol.messages.EndSessionMsg;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import oop.ex3.exceptions.InvalidMessageException;

/**
 * Get an endsession message from a FM.
 * @author daniel
 */
public class NameEndSession extends NameToFileSession{

	/**
	 * Create a new session.
	 */
    public NameEndSession() {
        super (new EndSessionMsg());
    }

    @Override
    protected boolean specExecuteSession(DataInputStream inputStream, DataOutputStream outputStream) throws IOException, InvalidMessageException {
        //get an end session and send done
        _endSession.receive(inputStream);
        _done.send(outputStream);

        return true;
    }

}
